const express = require('express')
const multer = require('multer')

const router = express.Router()

const storage = multer.diskStorage({
    destination: function (req, file, cb) {
        cb(null, 'public/upload')
    },
    filename: function (req, file, cb) {
        cb(null,file.originalname)
    }
})
const upload = multer({ storage: storage })

const employeeHandler = require('../router-handler/employee')

router.get('/get_employee',employeeHandler.employee)
router.get('/search_employee',employeeHandler.searchEmployee)
router.delete('/delete_employee/:id',employeeHandler.deleteEmployee)
router.post('/upload_employee_avatar',upload.single('avatar'),employeeHandler.uploadEmployeeAvatar)
router.post('/add_employee',employeeHandler.addEmployee)

module.exports = router